$str = "this is a string fa *%^&";

@a = $str =~ m/[^\w\s-]/g;

print @a;
$error_codes = @a;
print $error_codes;
